package com.seari.vehbaseP.web.controller;

import com.seari.vehbaseP.bean.CommonPartResponse;
import com.seari.vehbaseP.bean.DeviceInfo;
import com.seari.vehbaseP.service.DeviceInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping(value = "")
public class DeviceInfoController {

    @Autowired
    DeviceInfoService deviceInfoService;

    /**
     * 根据projectcode查询基地所有设备
     * @param projectcode
     * @return
     */
    @RequestMapping(value = "/device",method = RequestMethod.POST)
    @ResponseBody
    public CommonPartResponse getAllDevice(@RequestParam(value = "ProjectCode")String projectcode){

        return deviceInfoService.seachDeviceInfo(projectcode);

    }

    /**
     * 查询系统分类下的所有设备
     * @param projectcode
     * @param systemcode
     * @return
     */
    @RequestMapping(value = "/deviceBySystem",method = RequestMethod.POST)
    @ResponseBody
    public CommonPartResponse getAllDeviceBySystem(@RequestParam(value = "ProjectCode")String projectcode,@RequestParam(value = "SystemCode")String systemcode){

        return  deviceInfoService.seachDeviceInfoBySystem(projectcode,systemcode);

    }
}